<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/6/5
 * Time: 12:21
 */

namespace app\common\model;


use think\Model;

/**
 * 文档表模型
 * @property integer $id
 * @property string $title
 * @property integer $click
 * @property integer $created
 * @property integer $last_updated
 * @property string $description
 * @property string $title_image
 * @property string $img_type
 * @property integer $like_num
 * @property integer $comment_num
 * @property integer $is_del
 *
 * Archives Model
 * @package app\common\model
 */
class Archives extends Model
{
    const DELETED = 1,         //删除
        NOT_DELETED = 0;       //未删除
    protected $table = 'e8_archives';
    protected $pk = 'id';
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $createTime = 'created';
    protected $updateTime = 'last_updated';

    /**
     * 文档表类型关联ArchivesType
     * @return string|\think\db\Query
     */
    public function type(){
        return $this->hasOne('ArchivesType','id','type_id');
    }
    public function article(){
        return $this->hasOne('AddonArticle','aid','id');
    }
    public function project(){
        return $this->hasOne('AddonProject','aid','id');

    }
    public function comment(){
        return $this->hasMany('Comment','aid','id');
    }

}